package com.changpei.core.controller;

import com.changpei.common.cache.ContentCache;
import com.changpei.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 *
 * @author Way on 2021/9/19
 */
@RestController
@RequestMapping("/hot")
@CrossOrigin
public class HotController {

    @Autowired
    private ContentCache contentCache;

    /**
     * 缓存中查询
     * @return
     */
    @GetMapping(value = "/words")
    public Result<List<String>> getCategory() {
        return Result.ok(contentCache.getHotWords());
    }
}
